﻿Imports System.Text
Imports Microsoft.VisualStudio.TestTools.UnitTesting

Imports CQRSAzure.Tools

<TestClass()> Public Class EventPropertyOperationModelUnitTest

    <TestMethod()>
    Public Sub Constructor_TestMethod()

        Dim testObj As New EventPropertyOperationModel("From", "To", EventPropertyOperationModel.PropertyOperation.SetToValue)
        Assert.IsNotNull(testObj)

    End Sub

    <TestMethod>
    Public Sub SourceEventName_RoundTrip_TestMethod()

        Dim expected As String = "ExpectedSourceName"
        Dim actual As String = "ActualName"

        Dim testObj = New EventPropertyOperationModel(expected, "To", EventPropertyOperationModel.PropertyOperation.IncrementByValue)
        actual = testObj.SourcePropertyName

        Assert.AreEqual(expected, actual)

    End Sub

    <TestMethod>
    Public Sub TargetEventName_RoundTrip_TestMethod()

        Dim expected As String = "ExpectedTargetName"
        Dim actual As String = "ActualName"

        Dim testObj = New EventPropertyOperationModel("From", expected, EventPropertyOperationModel.PropertyOperation.IncrementByValue)
        actual = testObj.TargetPropertyName

        Assert.AreEqual(expected, actual)

    End Sub

    <TestMethod>
    Public Sub EventPropertyOperationModelPropertyOperation_DecrementByValue_RoundTrip_TestMethod()

        Dim expected As EventPropertyOperationModel.PropertyOperation = EventPropertyOperationModel.PropertyOperation.DecrementByValue
        Dim actual As EventPropertyOperationModel.PropertyOperation

        Dim testObj = New EventPropertyOperationModel("From", "To", expected)
        actual = testObj.Operation

        Assert.AreEqual(expected, actual)

    End Sub

    <TestMethod>
    Public Sub EventPropertyOperationModelPropertyOperation_SetToValue_RoundTrip_TestMethod()

        Dim expected As EventPropertyOperationModel.PropertyOperation = EventPropertyOperationModel.PropertyOperation.SetToValue
        Dim actual As EventPropertyOperationModel.PropertyOperation

        Dim testObj = New EventPropertyOperationModel("From", "To", expected)
        actual = testObj.Operation

        Assert.AreEqual(expected, actual)

    End Sub

End Class